<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="root">
    <book-list cl="blue" title="男生爱看" :book-list="bodyBookList"></book-list>
    <book-list cl="pink" title="女生必读" :book-list="girlBookList"></book-list>
</div>
</body>
<script>
    new Vue({
        el: "#root",
        data: {
            bodyBookList: [
                {
                    id: 3642117,
                    // href:"https://www.17k.com/book/3642117.html",
                    title: "末世囤货：打造百吨王，碾碎一切"
                }, {
                    id: 3646227,
                    title: "高武，被女帝狩猎，护道人你也杀？"
                }
            ],
            girlBookList: [
                {
                    id: 3419269,
                    title: "主播三岁半，萌翻全宇宙！"
                }, {
                    id: 3634103,
                    title: "重生后我靠空间门玩遍世界"
                }
            ]
        },
        components: {
            BookList: {
                props: {
                    cl:String,
                    title: {
                        type: String,
                        required: true
                    },
                    bookList: Array

                },
                template: (`
				    <div>
				        <h3 :style="{color:cl}">{{title}}</h3>
                        <p v-for="item in bookList" :key="item.id">
                            <a :href="'https://www.17k.com/book/'+item.id+'.html'" target="_blank">{{item.title}}</a>
                        </p>
                        <hr/>
                    </div>

				`)
            }
        }
    })
</script>
</html>